package com.joker.userExam.utils.enumUtils;

import lombok.experimental.UtilityClass;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author 李杰
 * @date 2021/5/2 - 12:05
 */
@UtilityClass
public class RandomUtils {

    /**
     * 获取0~maxNum的100个随机数
     * @param maxNum
     * @return
     */
    public List<Integer> getRandomList(Integer maxNum, Integer range) {
        Random rand = new Random();
        List<Integer> randomList = new ArrayList<>();
        for (Integer i = 0; i < range; i++) {
            randomList.add(rand.nextInt(maxNum) + 1);
        }
        return randomList;
    }
}
